import React, { Component } from 'react';
import { Menu, Button } from 'antd';
import '../../node_modules/antd/dist/antd.css';

import './style/header.css';

const { Item } = Menu;

class Header extends Component {
  constructor(props) {
    super(props);
    this.state = {
        current: 'design'
    };
  }

  handleClick = (e) => {
    this.setState({
        current: e.key
    });
    const { accpetType } = this.props;
    accpetType(e.key);
  }

  render() {
      const { current } = this.state;
    return (
      <div className="header">
        <Menu onClick={this.handleClick} selectedKeys={[current]} mode="horizontal">
            <Item key="design">
                设计
            </Item>
            <Item key="code">
                代码
            </Item>
        </Menu>
        <Button type="primary">保存</Button>
      </div>
    );
  }
}


export default Header;

